home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.3 Development Libraries / SGI IRIX 6.3 Development Libraries.iso / dist6.3 / ViewKit_dev.idb / usr / include / Vk / VkComponent.h.z / VkComponent.h
Encoding:
C/C++ Source or Header  |  1996-09-20  |  4.3 KB  |  127 lines

  1.  
  2. ////////////////////////////////////////////////////////////////////////////////
  3. ///////   Copyright 1992, Silicon Graphics, Inc.  All Rights Reserved.   ///////
  4. //                                                                            //
  5. // This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;     //
  6. // the contents of this file may not be disclosed to third parties, copied    //
  7. // or duplicated in any form, in whole or in part, without the prior written  //
  8. // permission of Silicon Graphics, Inc.                                       //
  9. //                                                                            //
  10. // RESTRICTED RIGHTS LEGEND:                                                  //
  11. // Use,duplication or disclosure by the Government is subject to restrictions //
  12. // as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data     //
  13. // and Computer Software clause at DFARS 252.227-7013, and/or in similar or   //
  14. // successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -    //
  15. // rights reserved under the Copyright Laws of the United States.             //
  16. //                                                                            //
  17. ////////////////////////////////////////////////////////////////////////////////
  18.  
  19.  
  20. #ifndef VKCOMPONENT_H
  21. #define VKCOMPONENT_H
  22.  
  23. #include <Xm/Xm.h>
  24. #include <Vk/VkCallbackObject.h>
  25.  
  26. class VkNameList;
  27.  
  28. class VkComponent : public VkCallbackObject {
  29.  
  30.  public:
  31.  
  32.     virtual ~VkComponent();
  33.  
  34.     virtual void show();      // make the component visible
  35.     virtual void hide();      // remove the component from the screen
  36.     virtual void realize();   // Shouldn't use in normal circumstances
  37.  
  38.     void manage()   { show(); } // For compatibility with components based on C++/Motif book
  39.     void unmanage() { hide(); } // For compatibility with components based on C++/Motif book
  40.   
  41.     const char * name() const { return _name; }
  42.     virtual const char *className();
  43.     Widget baseWidget() const;
  44.  
  45.     virtual Boolean okToQuit();
  46.  
  47.     static Boolean isComponent(VkComponent *);
  48.  
  49.     static const char * const deleteCallback;
  50.  
  51.     virtual operator Widget () const;
  52.  
  53.     virtual void setAttribute(const char *, void *); // For future use
  54.  
  55.     virtual char **attributeList(); // For future use
  56.  
  57.     virtual void getAttribute(const char *, void **); // For future use
  58.  
  59.     // The following member function supports dynamic loading
  60.     // of objects, as supported by rapidapp. Objects must be
  61.     // set up properly for this to work. See man VkComponent
  62.     // and man VkCallbackObject or the rapidapp documentation for details.
  63.     
  64.     static VkComponent *loadObject(const char *name,
  65.                    Widget parent,
  66.                    const char *className,
  67.                    const char *filename);
  68.   protected:
  69.  
  70.     // Support for dynamic widget destruction
  71.  
  72.     void installDestroyHandler();   // Easy hook for derived classes
  73.     void removeDestroyHandler();    // Easy hook for derived classes
  74.     virtual void widgetDestroyed(); // Called when base widget is destroyed
  75.  
  76.     // Suport for doing things after realize time
  77.     // This function is actually called when this
  78.     // component is mapped
  79.  
  80.     virtual void afterRealizeHook();
  81.  
  82.     // Support for using the X resource manager
  83.  
  84.     void setDefaultResources ( const Widget , const String * );
  85.     void getResources ( const XtResourceList, const int );
  86.  
  87.     // members useful to derived classes
  88.  
  89.     char   *_name;
  90.     Widget  _baseWidget;    
  91.     Widget& _w;       // For compatibility with components based on C++/Motif book
  92.  
  93.     VkComponent( const char *name );     // Protected constructor forces subclasses to redefine
  94.     VkComponent();   // Default constructor should never be used, but may be called from subclass
  95.                      // default constructors, which should probably also not be used....
  96.  
  97.     void *_extension;
  98.     
  99.   private:
  100.  
  101.    // Support for sanity check of object validity
  102.  
  103.     VkComponent *_self;  
  104.  
  105.     static void widgetDestroyedCallback ( Widget, 
  106.                       XtPointer, 
  107.                       XtPointer );
  108.  
  109.     static void afterRealizeEventHandler ( Widget, 
  110.                        XtPointer, 
  111.                        XEvent *,
  112.                        Boolean *);
  113.  
  114.  
  115. };
  116.  
  117.  
  118. // A convenience for applications that need to pass both an object and other client data
  119. // This should almost NEVER be needed
  120.  
  121. typedef struct {
  122.     void *client_data;
  123.     void *obj;
  124. } VkCallbackStruct;
  125.  
  126. #endif
  127.